package com.usian.admin.controller;

import com.usian.admin.service.AdSensitiveService;
import com.usian.apis.admin.AdChannelControllerApi;
import com.usian.apis.admin.AdSensitiveControllerApi;
import com.usian.model.admin.dtos.ChannelDto;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdChannel;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
@Api(tags = "敏感词管理")
public class AdSensitiveController implements AdSensitiveControllerApi {

    @Autowired
    private AdSensitiveService adSensitiveService;


    @PostMapping("/list")
    @ApiOperation(value = "查询敏感词信息",notes = "根据名称分页查询敏感词列表")
    @Override
    public ResponseResult getByName(@RequestBody SensitiveDto dto) {
        return adSensitiveService.getByName(dto);
    }

    @PostMapping("/save")
    @ApiOperation(value = "添加敏感词信息",notes = "添加敏感词列表")
    @Override
    public ResponseResult add(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.add(adSensitive);
    }

    @PostMapping("/update")
    @ApiOperation(value = "修改敏感词信息",notes = "修改敏感词列表")
    @Override
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.update(adSensitive);
    }

    @DeleteMapping("/del/{id}")
    @ApiOperation(value = "删除敏感词信息",notes = "删除敏感词列表")
    @Override
    public ResponseResult deleteById(@PathVariable Integer id) {
        return  adSensitiveService.deleteById(id);
    }
}
